<template>
    <div>
        <my-workshop v-model="workshopId" workshopProperty = "117" />
        <my-ji-jian v-model="jjId" :workshopId='workshopId' />

        <my-cangku v-model="cangkuId"/>
        <my-kuwei v-model="kuweiId" :cangkuId="cangkuId" />

        <my-file-upload ref="myfileupload">
        </my-file-upload>

        <el-button type="primary" icon="el-icon-plus" size="mini" @click="testFileupload">获取上传文件</el-button>
        <el-button type="primary" icon="el-icon-plus" size="mini" @click="onSumbitUpload">上传文件</el-button>

        <template>
            <el-table :data="fileList" border style="width: 100%">
                <el-table-column fixed prop="name" label="文件名称">
                </el-table-column>

                <el-table-column prop="response.url" label="文件路径" width="120">
                </el-table-column>

                <el-table-column fixed="right" label="操作">
                    <template slot-scope="scope">
                        <el-button @click="myfilemove(scope.row)" type="text" size="small">移动</el-button>
                        <el-button @click="myfiledelete(scope.row)" type="text" size="small">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
        </template>
    </div>
</template>

<script>

import { filemove, filedelete } from "@/api/erp/system/FileUtils";

export default {
    name: "Hetong",
    components: {
    },
    data() {
        return {
            fileList: [],
            workshopId: 0,
            jjId: 0,
            cangkuId:0,
            kuweiId:0
        }
    },
    methods: {
        myfilemove(row){
            filemove({filePath:row.response.url}).then(response => {
                this.msgSuccess("移动成功");
            });
        },
        myfiledelete(row){
            filedelete({filePath:row.response.url}).then(response=>{
                this.msgSuccess("删除成功");
            });
        },
        testFileupload(){
        console.log( this.$refs.myfileupload.fileList );
        this.fileList = this.$refs.myfileupload.fileList;
        },
        onSumbitUpload(){
        this.$refs.myfileupload.submitUpload();
        },
    },
    created() {
        
    },
}
</script>

<style lang="scss" scoped>

</style>